﻿#region Copyright Notice
// 
// 
//  
//  Copyright (c) 2009-2011 Anindya Chatterjee
//  
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//  
//      http://www.apache.org/licenses/LICENSE-2.0
//  
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
// 
// 
#endregion
using System.Collections;
using System.Collections.Generic;

namespace AbstractClass.Collections.Generic
{
    /// <summary>
    /// Defines methods to manipulate a queue.
    /// </summary>
    /// <typeparam name="T">The type of the data in the queue.</typeparam>
    public interface IQueue<T> : IEnumerable<T>, ICollection
    {
        /// <summary>
        /// Enqueues the specified item.
        /// </summary>
        /// <param name="item">The item to enqueue.</param>
        void Enqueue(T item);

        /// <summary>
        /// Dequeues the peek element.
        /// </summary>
        /// <returns>The removed element.</returns>
        T Dequeue();

        /// <summary>
        /// Fetches the top element from the queue.
        /// </summary>
        /// <returns>The top element.</returns>
        T Peek();

        /// <summary>
        /// Clears the queue by removing all of its elements.
        /// </summary>
        void Clear();

        /// <summary>
        /// Copies the elements of the queue to an array of type <typeparamref name="T"/>
        /// , starting at the specified array index.
        /// </summary>
        /// <param name="array">The one-dimensional array of type <typeparamref name="T"/> that is the destination of
        /// the elements copied from the queue. The array must have zero-based indexing.
        ///	 </param>
        /// <param name="index">The zero-based index in array at which copying begins.</param>
        void CopyTo(T[] array, int index);

        /// <summary>
        /// Determines whether the queue contains the specified item.
        /// </summary>
        /// <param name="item">The item to search.</param>
        /// <returns>
        /// 	<c>true</c> if the queue contains the specified item; otherwise, <c>false</c>.
        /// </returns>
        bool Contains(T item);
    }
}